//document.write("<h1>This is a header</h1>");
//<script type="text/javascript" src="jquery-1.7.2.js">
 //<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 
$(function()
{
	
	$("#divMsg").ajaxStart(function() {
		$(this).html("The Confirm is sending ... ");
		$(this).show();
	});
	
	$("#divMsg").ajaxComplete(function() {
		//$("#disMsg").css("display","none");
		$(this).html("The message has sent").hide();
	});
	
	$("#button1").click(function() {
		var $name=$("#txtName");
		var $pass=$("#txtPass");
		if($name.val() != "" && $pass.val()!=""){
			UserLogin($name.val(), $pass.val());
		}
		else{
			if($name.val() == ""){
				alert("UserName can't be null!");
				$name.focus();
				return false;
			}else {
				alert("Code can't be null!");
				$pass.focus();
				return false;
			}	
		}
	});
});

function UserLogin(name, pass)  
{
	$.ajax({
		type:"POST",
		url: "LogicLevel/DealData.js",
		data: "action=login&d="+new Date()+"&name="
			   +name+"$pass="+pass,
		success: function(data){	
			if(data == "True"){
				window.location="Main.html";
			}
			else{
				alert("UserName or Code ERROR!");
				return false;
			}
		}
			   
	});
}















